﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>输入框的默认值为今天</title>
</head>
<body>
<input type="text" id="myDate" />
<script type="text/javascript">
    var now = new Date();               //或全今天的日期-显示为日期和时间
    myDate.value=now.getFullYear() + "-"+ (now.getMonth()+1)+"-"+now.getDate(); //获取年月日
</script>
</body>
</html>